using System;
using HCP.Responses;
using HCP.SimpleJSON;
using UnityEngine;
using UnityEngine.UI;

namespace HCP.Requests
{
	public class GetElementText : JobRequest
	{
		public GetElementText(JSONClass json) : base(json)
		{
		}

		public string Id
		{
			get
			{
				return base.Data["elementId"];
			}
		}

		public override JobResponse Process()
		{
			Component elementById = JobRequest.GetElementById(this.Id);
			Text component = elementById.GetComponent<Text>();
			InputField component2 = elementById.GetComponent<InputField>();
			string value = string.Empty;
			if (component != null)
			{
				value = component.text;
			}
			else
			{
				value = component2.text;
			}
			return new StringResponse(value);
		}
	}
}
